The Hit-Test Info Structure
The hit-test info structure is a structure in which both theGXHitTestShape
andGXHitTestPicture
functions return information.GXHitTestShape
uses only
the first three fields;GXHitTestPicture
uses all seven fields.
struct gxHitTestInfo { gxShapePart what; long index; Fixed distance; gxShape which; gxShape containerPicture; long containerIndex; long totalIndex; };The
Field Description
- what
- The parts of the shape that were hit, if any. QuickDraw GX returns in this field a mask denoting all shape parts (out of those specified for the hit-test) that are within the tolerance of the hit-test from
the hit point. Shape parts are defined in thegxShapeParts
enumeration; the tolerance and the subset of shape parts to test for make up the hit-test parameters. All are described in the chapter "Transform Objects" in this book.- index
- The index of the nearest point in the geometry to the hit point. Every point in a shape's geometry has an index number (indexes start at 1).
- distance
- The distance in geometry units from the hit point to the closest point on the shape part that was hit. (If no part was hit, this value is undefined.) If more than one shape part was hit, this is the distance to the first shape part encountered that is within the tolerance of the hit point. The order in which shape parts are examined during hit-testing is defined by the
gxShapeParts
enumeration, described in the chapter "Transform Objects" in this book.- which
- A reference to the specific shape that was hit. (Used only by
GXHitTestPicture
.)- containerPicture
- A reference to the picture shape that immediately contains the specific shape that was hit. Note that this may be a picture shape contained at some level within the picture shape specified in the call to
GXHitTestPicture
. (Used only byGXHitTestPicture
.)- containerIndex
- The index number--within the immediately containing shape--of the specific shape that was hit. (Used only by
GXHitTestPicture
.)- totalIndex
- The index number--within the picture shape specified in the call to
GXHitTestPicture
--of the specific shape that was hit. (Used only byGXHitTestPicture
.)GXHitTestShape
function is described on page 2-86. TheGXHitTestPicture
function is described in the picture shapes chapter of Inside Macintosh: QuickDraw GX Graphics.